# geometric test using the head_neck geometry

#!/usr/bin/env python
from scipy import *
from enthought.mayavi import mlab
import sys
sys.path.append( '../' )

from field import template_fields
from field import geometric_field
from field.topology import element_types
from interactive import geometric_field_interactor as interactor

# head neck parameters
h_r = 20.0
n_l = 30.0
n_r = None

eval_density = 10

# instantiate a neck_neck field
(head_neck, xparam, yparam, zparam, cp) = template_fields.head_neck( h_r, n_l, n_r, )

# instantiate a geometric field with the head_neck field and parameters
gf = geometric_field.geometric_field( 'test', 3, head_neck )
gf.set_field_parameters( [xparam, yparam, zparam] )

# add some points and store their point numbers in p
p = []
p.append( gf.add_geometric_point([[14.0],[6.0],[-50.0]], name = 'test1') )
p.append( gf.add_geometric_point([[13.4],[10.3],[-55.0]], name = 'test2') )
p.append( gf.add_geometric_point([[6.0],[13.0],[-50.0]], name = 'test3') )

# create a quadratic triangular element
element = element_types.create_element( 'tri6' )

# add element to mesh using the interactor
adder = interactor.element_adder( gf )
adder.add_element( element )

